<?php
/**
 * Created by PhpStorm.
 * User: kb168
 * Date: 2017/3/9
 * Time: 17:45
 */
namespace soa\orders;

class Rule{


    /**
     * 消息提醒，订单锚点来源校验
     * @param $channel
     * @return bool
     */
    function orderClannelAnchor($channel){
        if(empty($channel)){
            return false;
        }
        if(!in_array($channel,['web_m','weixin','alipay','androidc','iosc'])){
            return false;
        }
        return true;
    }

    /**
     * 订单类型校验
     * @param $type
     * @return bool
     */
    function orderType($type){
        if(empty($type) || !in_array($type,['applet','withhold','normal'])){ //订单类型  withhold：代扣  normal：普通订单
            return false;
        }
        return true;
    }

    /**
     * C端下单是否推送至第三方，订单渠道校验
     * @param $channel
     * @return bool
     */
    function isPushTP($channel){
        if(empty($channel) || !in_array($channel,['web_m','weixin','alipay','androidc','iosc','mina_ios','mina_android'])){ //mina 小程序
            return false;
        }
        return true;
    }

    /**
     * 回填单号订单状态校验
     * @param $status
     * @return bool
     */
    function setWaybillNo($status){
        if(empty($status) || !in_array($status,['2','108'])){
            return false;
        }
        return true;
    }



}